package com.example.ccj.b.c.form;

import androidx.annotation.IntDef;
import androidx.annotation.IntRange;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 表单字段注解
 * @author 驰珺
 * whechat   : chijun9
 * create at : 2024/6/24 9:57
 */
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface MFormField {
    String hint() default "";//字段填写提示
    //字段名称
    String value();//字段名称 表单中显示的名称，对应类的字段名称或者数据库字段名称
    //略过此字段
    boolean isSkip() default false;
    //最大长度
    int maxLength() default 255;
    //是否不可为空
    boolean isNoNUll() default false;
    //是否只可选择
    boolean isOnlySelect() default false;
    boolean isCanModify() default true;
    //顺序
    @IntRange(from = 0,to = 999) int order() default 0;
    //字段类型
    @Type int type() default TEXT;
    String[] option() default {};


    //关联的上级字段
    //关联字段写法：[所关联的上级字段名称.选项编号,所关联的上级字段名称.选项编号,。。。。。。。。]
    String superF() default "";




    int TEXT = 1;
    //数字
    int NUMBER = 2;
    //小数
    int XIAO_SHU = 3;
    //扫码
    int SCAN = 4;
    //单选项
    int DAN_OPTION = 5;
    //多选项
    int MULTIPLE_OPTION = 6;
    int IMG = 7;
    int TIME = 8;
    int BOOLEAN = 9;
    int JUMP = 10;


    @IntDef({TEXT,NUMBER, XIAO_SHU,SCAN, DAN_OPTION,MULTIPLE_OPTION,IMG,TIME,BOOLEAN,JUMP})
    @Retention(RetentionPolicy.SOURCE)
    @interface Type{ }
}



